unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,EncdDecd;

type
  TFormMain = class(TForm)
    Memo1: TMemo;
    Edit1: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormMain: TFormMain;

implementation
uses VCLZip,VCLUnZip;

{$R *.dfm}
function Cmip_CompressStr(txt: String): String;
var
  zip: TVclZip;
begin
  zip := TVclZip.Create(nil);
  try
    Result := zip.ZLibCompressStr(txt);
    Result := EncodeString(Result);
  finally
    zip.Free;
  end;
end;
function Cmip_DeCompressStr(txt: String): String;
var
  zip: TVCLUnZip;
begin
  zip := TVCLUnZip.Create(nil);
  try
    Result := DecodeString(txt);
    Result := zip.ZLibDecompressString(Result);

  finally
    zip.Free;
  end;
end;

procedure TFormMain.Button1Click(Sender: TObject);
var
  sText : string;
begin
  sText := Trim(Edit1.Text);
  sText := Cmip_CompressStr(sText);
  Memo1.Lines.Add(sText);

  sText := Cmip_DeCompressStr(sText);
  Memo1.Lines.Add(sText);

end;

end.
